package com.itheima.advantagesup.mapper;

import com.itheima.advantagesup.entity.SysMenu;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MenuMapper {

    /**
     * 添加
     *
     * @param sysMenu 菜单签证官
     */
    void add(SysMenu sysMenu);
    /**
     * 菜单删除
     * @param id
     */
    @Delete("delete from sys_menu where id=#{id}")
    void delMenu(Integer id);

    /**
     * 选择列表
     *
     * @return {@link List}<{@link SysMenu}>
     */
    @Select("select id, pid, path, component, title, icon, is_show, is_cache, is_link, redirect, create_date, update_date, del_flag, type, sort, mark, default_data from sys_menu")
    List<SysMenu> selectList();


    /**
     * selete sys菜单通过id
     *
     * @param id id
     * @return {@link SysMenu}
     */
    @Select("select * from sys_menu where id = #{id}")
    SysMenu seleteSysMenuById(Integer id);


    /**
     * 更新菜单
     *
     * @param menu 菜单
     */
    void updateMenu(SysMenu menu);

}
